<template>
  <t-tabs v-model="value" size="medium">
    <t-tab-panel :class="[reviewOpen ? 'tab-full-panel' : 'tab-panel']" value="1" label="基本信息">
      <t-form :colon="true" labelAlign="top" ref="form" class="step-form table-form">
        <t-row>
          <t-col :span="1" class="title">项目概况</t-col>
          <t-col :span="11" class="sub-col">
            <t-row style="width: 100%">
              <t-col :span="2" class="title"><span class="require">*</span>项目名称</t-col>
              <t-col :span="10">
                <t-form-item name="projectName">
                  {{ data.projectName }}
                </t-form-item>
              </t-col>
            </t-row>
            <t-row>
              <t-col :span="2" class="title"><span class="require">*</span>项目类别</t-col>
              <t-col :span="10">
                <t-form-item name="projectCategory">
                  <t-radio-group v-model="data.projectCategory" :disabled="true"
                    :options="categoryOptions"></t-radio-group>
                </t-form-item>
              </t-col>
            </t-row>
            <t-row>
              <t-col :span="2" class="title"><span class="require">*</span>学科分类</t-col>
              <t-col :span="10">
                {{ data.subjectClassification | filterByDict(dict.type.subject_classification) }}
              </t-col>
            </t-row>
            <t-row>
              <t-col :span="2" class="title"><span class="require">*</span>关键词</t-col>
              <t-col :span="10">
                <t-form-item name="keyWord">
                  {{ data.keyWord }}
                </t-form-item>
              </t-col>
            </t-row>
            <t-row>
              <t-col :span="2" class="title"><span class="require">*</span>申报日期</t-col>
              <t-col :span="10">
                <t-form-item name="declareDate">
                  {{ data.declareDate }}
                </t-form-item>
              </t-col>
            </t-row>
            <t-row>
              <t-col :span="2" class="title"><span class="require">*</span>起止年月</t-col>
              <t-col :span="10">
                {{ data.startDate }} - {{ data.endDate }}
              </t-col>
            </t-row>
            <t-row>
              <t-col :span="2" class="title"><span class="require">*</span>建议经费总概算</t-col>
              <t-col :span="4">
                <t-form-item name="adviceFunding">
                  {{ data.adviceFunding }}万元
                </t-form-item>
              </t-col>
              <t-col :span="2" class="title"><span class="require">*</span>{{ site_tag === 'jtt' ? '申请厅补助经费：' :
                '申请集团补助经费：' }}
              </t-col>
              <t-col :span="4">
                <t-form-item name="subsidyFunding">
                  {{ data.subsidyFunding }}万元
                </t-form-item>
              </t-col>
            </t-row>
            <t-row>
              <t-col :span="2" class="title"><span class="require">*</span>依托平台（重点实验室、工程技术中心等）</t-col>
              <t-col :span="4">
                <t-form-item name="subsidyFunding">
                  <t-radio-group :disabled="true" :options="dict.type.platform_type"
                    v-model="data.platform"></t-radio-group>
                </t-form-item>
              </t-col>
              <t-col :span="2" class="title"><span class="require">*</span>所属创新团队</t-col>
              <t-col :span="4">
                <t-form-item name="subsidyFunding">
                  <t-radio-group :disabled="true" :options="dict.type.kjxm_team" v-model="data.team"></t-radio-group>
                </t-form-item>
              </t-col>
            </t-row>
            <t-row v-if="!hideInfo">
              <t-col :span="2" class="title">申报单位</t-col>
              <t-col :span="4">
                {{ data.declareDeptName }}
              </t-col>
              <t-col :span="2" class="title">归口管理单位</t-col>
              <t-col :span="4">
                {{ data.managerDeptName }}
              </t-col>
            </t-row>
          </t-col>
        </t-row>
        <t-row>
          <t-col :span="1" class="title"><span>项目组情况
              <t-tooltip content="研究人员数量系统自动计算">
                <t-icon name="help-circle-filled"></t-icon>
              </t-tooltip></span></t-col>
          <t-col :span="11" class="sub-col">
            <t-row>
              <t-col class="sub-title text-center" :flex="1">总人数</t-col>
              <t-col class="sub-title text-center" :flex="1">高级</t-col>
              <t-col class="sub-title text-center" :flex="1">中级</t-col>
              <t-col class="sub-title text-center" :flex="1">初级</t-col>
              <t-col class="sub-title text-center" :flex="1">研究生</t-col>
              <t-col class="sub-title text-center" :flex="1">辅助人员</t-col>
            </t-row>
            <t-row>
              <t-col class="text-center" :flex="1">{{ data.projectTeam.totalCount }}</t-col>
              <t-col class="text-center" :flex="1">{{ data.projectTeam.highCount }}</t-col>
              <t-col class="text-center" :flex="1">{{ data.projectTeam.middleCount }}</t-col>
              <t-col class="text-center" :flex="1">{{ data.projectTeam.primaryCount }}</t-col>
              <t-col class="text-center" :flex="1">{{ data.projectTeam.postgraduate }}</t-col>
              <t-col class="text-center" :flex="1">{{ data.projectTeam.auxilian }}</t-col>
            </t-row>
          </t-col>
        </t-row>
        <t-row v-if="!hideInfo">
          <t-col :span="1" class="title">项目负责人</t-col>
          <t-col :span="11" class="sub-col">
            <t-row>
              <t-col :span="2" class="title"><span class="require">*</span>姓名</t-col>
              <t-col :span="4">
                <t-form-item name="projectLeader.name">
                  {{ data.projectLeader.name }}
                </t-form-item>
              </t-col>
              <t-col :span="2" class="title"><span class="require">*</span>性别</t-col>
              <t-col :span="4">
                <t-form-item name="projectLeader.sex">
                  {{ data.projectLeader.sex | filterByDict(dict.type.sys_user_sex) }}
                </t-form-item>
              </t-col>

            </t-row>
            <t-row>
              <t-col :span="2" class="title"><span class="require">*</span>身份证号</t-col>
              <t-col :span="4">
                <t-form-item label="身份证号：" name="projectLeader.idCard">
                  {{ data.projectLeader.idCard }}
                </t-form-item>
              </t-col>
              <t-col :span="2" class="title"><span class="require">*</span>出生年月</t-col>
              <t-col :span="4">
                <t-form-item name="projectLeader.birthDate">
                  {{ data.projectLeader.birthDate }}
                </t-form-item>
              </t-col>
            </t-row>
            <t-row>
              <t-col :span="2" class="title"><span class="require">*</span>工作单位</t-col>
              <t-col :span="4">
                <t-form-item name="projectLeader.companyId">
                  {{ data.projectLeader.company }}
                </t-form-item>
              </t-col>
              <t-col :span="2" class="title"><span class="require">*</span>职务</t-col>
              <t-col :span="4">
                <t-form-item name="projectLeader.duty">
                  {{ data.projectLeader.duty }}
                </t-form-item>
              </t-col>
            </t-row>
            <t-row>
              <t-col :span="2" class="title"><span class="require">*</span>技术职称</t-col>
              <t-col :span="4">
                <t-form-item name="projectLeader.profTitId">
                  {{ data.projectLeader.profTitId | filterByTree(profTitOptions, children = "children", id = "id", label
                    = "name") }}
                </t-form-item>
              </t-col>
              <t-col :span="2" class="title"><span class="require">*</span>职称</t-col>
              <t-col :span="4">
                <t-form-item name="projectLeader.profTit">
                  {{ data.projectLeader.profTit | filterByDict(dict.type.prof_tit) }}
                </t-form-item>
              </t-col>
            </t-row>
            <t-row>
              <t-col :span="2" class="title"><span class="require">*</span>通讯地址</t-col>
              <t-col :span="10">
                <t-form-item name="projectLeader.address">
                  {{ data.projectLeader.address }}
                </t-form-item>
              </t-col>
            </t-row>
            <t-row>
              <t-col :span="2" class="title"><span class="require">*</span>联系电话</t-col>
              <t-col :span="4">
                <t-form-item label="联系电话：" name="projectLeader.phone">
                  {{ data.projectLeader.phone }}
                </t-form-item>
              </t-col>
              <t-col :span="2" class="title"><span class="require">*</span>邮编</t-col>
              <t-col :span="4">
                <t-form-item name="projectLeader.postCode">
                  {{ data.projectLeader.postCode }}
                </t-form-item>
              </t-col>
            </t-row>
            <t-row>
              <t-col :span="2" class="title"><span class="require">*</span>学历</t-col>
              <t-col :span="4">
                <t-form-item name="projectLeader.education">
                  {{ data.projectLeader.education | filterByDict(dict.type.education) }}
                </t-form-item>
              </t-col>
              <t-col :span="2" class="title"><span class="require">*</span>学位</t-col>
              <t-col :span="4">
                <t-form-item name="projectLeader.degree">
                  {{ data.projectLeader.degree | filterByDict(dict.type.degree) }}
                </t-form-item>
              </t-col>
            </t-row>
            <t-row>
              <t-col :span="2" class="title"><span class="require">*</span>电子信箱</t-col>
              <t-col :span="4">
                <t-form-item name="projectLeader.email">
                  {{ data.projectLeader.email }}
                </t-form-item>
              </t-col>
              <t-col :span="2" class="title"><span class="require">*</span>毕业院校</t-col>
              <t-col :span="4">
                <t-form-item name="projectLeader.school">
                  {{ data.projectLeader.school }}
                </t-form-item>
              </t-col>
            </t-row>
            <t-row>
              <t-col :span="2" class="title"><span class="require">*</span>专业</t-col>
              <t-col :span="4">
                <t-form-item name="projectLeader.majorName">
                  {{ data.projectLeader.majorName }}
                </t-form-item>
              </t-col>
              <t-col :span="2" class="title"><span class="require">*</span>现从事专业</t-col>
              <t-col :span="4">
                <t-form-item name="projectLeader.majorNowName">
                  {{ data.projectLeader.majorNowName }}
                </t-form-item>
              </t-col>
            </t-row>
            <t-row>
              <t-col :span="2" class="title"><span class="require">*</span>本项目中承担的任务</t-col>
              <t-col :span="10">
                <t-form-item name="projectLeader.task">
                  {{ data.projectLeader.task }}
                </t-form-item>
              </t-col>
            </t-row>
            <t-row>
              <t-col :span="12" class="title">项目负责人成果情况（近五年）</t-col>
            </t-row>
            <t-row>
              <t-col :span="1" class="title">科技奖励</t-col>
              <t-col :span="11" class="sub-col">
                <t-row>
                  <t-col style="flex-direction: column;padding: 0 !important; border: 0;" :flex="1">
                    <t-row>
                      <t-col :span="12" class="sub-title text-center">国家级</t-col>
                    </t-row>
                    <t-row>
                      <t-col :span="12">
                        <t-form-item style="display: flex;justify-content: center"
                          name="projectLeaderResults.awardsGjCount">
                          {{ data.projectLeaderResults.awardsGjCount }}
                        </t-form-item>
                      </t-col>
                    </t-row>
                  </t-col>
                  <t-col style="flex-direction: column;padding: 0 !important; border: 0" :flex="1">
                    <t-row>
                      <t-col :span="12" class="sub-title text-center">省部级</t-col>
                    </t-row>
                    <t-row>
                      <t-col :span="12">
                        <t-form-item style="display: flex;justify-content: center"
                          name="projectLeaderResults.awardsSbCount">
                          {{ data.projectLeaderResults.awardsSbCount }}
                        </t-form-item>
                      </t-col>
                    </t-row>
                  </t-col>
                  <t-col class="sub-title text-center" :flex="1">专著/论文</t-col>
                  <t-col style="flex-direction: column;padding: 0 !important; border: 0" :flex="1">
                    <t-row>
                      <t-col :span="12" class="sub-title text-center">中文核心论文</t-col>
                    </t-row>
                    <t-row>
                      <t-col :span="12">
                        <t-form-item style="display: flex;justify-content: center"
                          name="projectLeaderResults.cnThesisCount">
                          {{ data.projectLeaderResults.cnThesisCount }}
                        </t-form-item>
                      </t-col>
                    </t-row>
                  </t-col>
                  <t-col style="flex-direction: column;padding: 0 !important; border: 0" :flex="1">
                    <t-row>
                      <t-col :span="12" class="sub-title text-center">SCI论文</t-col>
                    </t-row>
                    <t-row>
                      <t-col :span="12">
                        <t-form-item style="display: flex;justify-content: center"
                          name="projectLeaderResults.sciThesisCount">
                          {{ data.projectLeaderResults.sciThesisCount }}
                        </t-form-item>
                      </t-col>
                    </t-row>
                  </t-col>
                  <t-col style="flex-direction: column;padding: 0 !important; border: 0" :flex="1">
                    <t-row>
                      <t-col :span="12" class="sub-title text-center">EI论文</t-col>
                    </t-row>
                    <t-row>
                      <t-col :span="12">
                        <t-form-item style="display: flex;justify-content: center"
                          name="projectLeaderResults.eiThesisCount">
                          {{ data.projectLeaderResults.eiThesisCount }}
                        </t-form-item>
                      </t-col>
                    </t-row>
                  </t-col>
                  <t-col style="flex-direction: column;padding: 0 !important; border: 0" :flex="1">
                    <t-row>
                      <t-col :span="12" class="sub-title text-center">ISTP论文</t-col>
                    </t-row>
                    <t-row>
                      <t-col :span="12">
                        <t-form-item style="display: flex;justify-content: center"
                          name="projectLeaderResults.istpThesisCount">
                          {{ data.projectLeaderResults.istpThesisCount }}
                        </t-form-item>
                      </t-col>
                    </t-row>
                  </t-col>
                  <t-col style="flex-direction: column;padding: 0 !important; border: 0" :flex="1">
                    <t-row>
                      <t-col :span="12" class="sub-title text-center">专著</t-col>
                    </t-row>
                    <t-row>
                      <t-col :span="12">
                        <t-form-item style="display: flex;justify-content: center"
                          name="projectLeaderResults.treatiseCount">
                          {{ data.projectLeaderResults.treatiseCount }}
                        </t-form-item>
                      </t-col>
                    </t-row>
                  </t-col>
                  <t-col style="flex-direction: column;padding: 0 !important; border: 0" :flex="1">
                    <t-row>
                      <t-col :span="12" class="sub-title text-center">国际学术奖</t-col>
                    </t-row>
                    <t-row>
                      <t-col :span="12">
                        <t-form-item style="display: flex;justify-content: center"
                          name="projectLeaderResults.academicCount">
                          {{ data.projectLeaderResults.academicCount }}
                        </t-form-item>
                      </t-col>
                    </t-row>
                  </t-col>
                </t-row>
              </t-col>
            </t-row>
            <t-row>
              <t-col :span="1" class="title">成果转化</t-col>
              <t-col :span="11" class="sub-col">
                <t-row>
                  <t-col style="flex-direction: column;padding: 0 !important; border: 0;" :flex="1">
                    <t-row>
                      <t-col :span="12" class="sub-title text-center">中试</t-col>
                    </t-row>
                    <t-row>
                      <t-col :span="12">
                        <t-form-item style="display: flex;justify-content: center"
                          name="projectLeaderResults.pilotCount">
                          {{ data.projectLeaderResults.pilotCount }}
                        </t-form-item>
                      </t-col>
                    </t-row>
                  </t-col>
                  <t-col style="flex-direction: column;padding: 0 !important; border: 0;" :flex="1">
                    <t-row>
                      <t-col :span="12" class="sub-title text-center">规模化生产</t-col>
                    </t-row>
                    <t-row>
                      <t-col :span="12">
                        <t-form-item style="display: flex;justify-content: center"
                          name="projectLeaderResults.scaleCount">
                          {{ data.projectLeaderResults.scaleCount }}
                        </t-form-item>
                      </t-col>
                    </t-row>
                  </t-col>
                  <t-col class="sub-title text-center" :flex="1">专利</t-col>
                  <t-col style="flex-direction: column;padding: 0 !important; border: 0;" :flex="1">
                    <t-row>
                      <t-col :span="12" class="sub-title text-center">发明专利</t-col>
                    </t-row>
                    <t-row>
                      <t-col :span="12">
                        <t-form-item style="display: flex;justify-content: center"
                          name="projectLeaderResults.patentFmCount">
                          {{ data.projectLeaderResults.patentFmCount }}
                        </t-form-item>
                      </t-col>
                    </t-row>
                  </t-col>
                  <t-col style="flex-direction: column;padding: 0 !important; border: 0;" :flex="1">
                    <t-row>
                      <t-col :span="12" class="sub-title text-center">实用新型专利</t-col>
                    </t-row>
                    <t-row>
                      <t-col :span="12">
                        <t-form-item style="display: flex;justify-content: center"
                          name="projectLeaderResults.patentSyCount">
                          {{ data.projectLeaderResults.patentSyCount }}
                        </t-form-item>
                      </t-col>
                    </t-row>
                  </t-col>
                  <t-col style="flex-direction: column;padding: 0 !important; border: 0;" :flex="1">
                    <t-row>
                      <t-col :span="12" class="sub-title text-center">其他</t-col>
                    </t-row>
                    <t-row>
                      <t-col :span="12">
                        <t-form-item style="display: flex;justify-content: center"
                          name="projectLeaderResults.otherCount">
                          {{ data.projectLeaderResults.otherCount }}
                        </t-form-item>
                      </t-col>
                    </t-row>
                  </t-col>
                  <t-col style="flex-direction: column;padding: 0 !important; border: 0;" :flex="1">
                    <t-row>
                      <t-col :span="12" class="sub-title text-center">标准制（修）定</t-col>
                    </t-row>
                    <t-row>
                      <t-col :span="12">
                        <t-form-item style="display: flex;justify-content: center"
                          name="projectLeaderResults.standardCount">
                          {{ data.projectLeaderResults.standardCount }}
                        </t-form-item>
                      </t-col>
                    </t-row>
                  </t-col>
                </t-row>
              </t-col>
            </t-row>
          </t-col>
        </t-row>
        <t-row v-if="!hideInfo">
          <t-col :span="1" class="title">联系人</t-col>
          <t-col :span="11" class="sub-col">
            <t-row>
              <t-col :span="2" class="title"><span class="require">*</span>姓名</t-col>
              <t-col :span="4">
                <t-form-item name="projectLinker.name">
                  {{ data.projectLinker.name }}
                </t-form-item>
              </t-col>
              <t-col :span="2" class="title"><span class="require">*</span>联系电话</t-col>
              <t-col :span="4">
                <t-form-item name="projectLinker.phone">
                  {{ data.projectLinker.phone }}
                </t-form-item>
              </t-col>
            </t-row>
            <t-row>
              <t-col :span="2" class="title"><span class="require">*</span>通讯地址</t-col>
              <t-col :span="10">
                <t-form-item name="projectLinker.address">
                  {{ data.projectLinker.address }}
                </t-form-item>
              </t-col>
            </t-row>
            <t-row>
              <t-col :span="2" class="title"><span class="require">*</span>电子信箱</t-col>
              <t-col :span="4">
                <t-form-item name="projectLinker.email">
                  {{ data.projectLinker.email }}
                </t-form-item>
              </t-col>
              <t-col :span="2" class="title"><span class="require">*</span>邮编</t-col>
              <t-col :span="4">
                <t-form-item name="projectLinker.postCode">
                  {{ data.projectLinker.postCode }}
                </t-form-item>
              </t-col>
            </t-row>
          </t-col>
        </t-row>
        <t-row>
          <t-col :span="12" class="title"><span class="require">*</span>中文摘要（限500字）</t-col>
        </t-row>
        <t-row>
          <t-col :span="12">
            <t-form-item name="digest">
              <inner-html :content="data.digest"></inner-html>
            </t-form-item>
          </t-col>
        </t-row>
        <t-row>
          <t-col :span="2" class="title"><span class="require">*</span>关键词（不超过5个）：</t-col>
          <t-col :span="10">
            <t-form-item name="digestKeyWord">
              {{ data.digestKeyWord }}
            </t-form-item>
          </t-col>
        </t-row>
        <t-row>
          <t-col :span="12" class="title">系统查重项目列表<span style="color: red">(根据基本信息和摘要的关键词查询)</span></t-col>
        </t-row>
        <t-row>
          <t-col :span="12">
            <t-table rowKey="projectId" size="small" :data="data.projectEsModelList" :columns="columns" hover>
              <template #index="{ rowIndex }">
                {{ rowIndex + 1 }}
              </template>
              <template #op="{ row }">
                <t-button @click="dialog.objId = row.projectId; dialog.open_digest = true" size="small" variant="text"
                  class="t-button-link">
                  <t-icon name="info-circle" slot="icon" />
                  详情
                </t-button>
              </template>
            </t-table>
          </t-col>
        </t-row>
        <t-row>
          <t-col :span="12" class="title"><span class="require">*</span>系统查重结论</t-col>
        </t-row>
        <t-row>
          <t-col :span="12">
            <t-form-item name="reviewConclusion">
              <inner-html :content="data.reviewConclusion"></inner-html>
            </t-form-item>
          </t-col>
        </t-row>
      </t-form>
      <project-digest-dialog :objId="dialog.objId" :visible.sync="dialog.open_digest"
        v-if="dialog.open_digest"></project-digest-dialog>
    </t-tab-panel>
    <t-tab-panel :class="[reviewOpen ? 'tab-full-panel' : 'tab-panel']" value="2" label="项目概况">
      <t-form ref="form" :colon="true" labelAlign="top">
        <t-row>
          <t-col :span="12">
            <t-card class="step-card" size="small" title="1.立项依据、研究内容、目标以及拟解决的关键科学问题（限1000字）">
              <t-form-item name="baseContent">
                <inner-html :content="data.projectOverview.baseContent"></inner-html>
              </t-form-item>
            </t-card>
          </t-col>
        </t-row>
        <t-row>
          <t-col :span="12">
            <t-card class="step-card" size="small" title="2.拟采取的研究方案及可行性分析、本项目的特色与创新之处（限1000字）">
              <t-form-item name="approach">
                <inner-html :content="data.projectOverview.approach"></inner-html>
              </t-form-item>
            </t-card>
          </t-col>
        </t-row>
        <t-row>
          <t-col :span="12">
            <t-card class="step-card" size="small" title="3.预期研究结果及表达形式（限500字）">
              <t-form-item name="achievement">
                <inner-html :content="data.projectOverview.achievement"></inner-html>
              </t-form-item>
            </t-card>
          </t-col>
        </t-row>
      </t-form>
    </t-tab-panel>
    <t-tab-panel :class="[reviewOpen ? 'tab-full-panel' : 'tab-panel']" value="3" label="研究人员">
      <t-alert style="margin-bottom: 14px" theme="info" title="填表说明：">
        <div slot="message">
          <p class="span-txt">
            1.青年科技人员数量占比不低于10%；
          </p>
          <p>2.职业教育改革专项、青年科技项目原则上项目负责人应为1名。</p>
          <p>3.青年人员，具有博士学位，年龄在40周岁以下；具有硕士学位、年龄在35周岁以下，女性年龄可适当放宽2周岁，以上年龄截至申报时间上一年度年底。</p>
        </div>
      </t-alert>
      <project-member :show-tip="true" v-model="data.projectMemberList" :projectId="objId"
        phaseType="1"></project-member>
    </t-tab-panel>
    <t-tab-panel :class="[reviewOpen ? 'tab-full-panel' : 'tab-panel']" value="4" label="项目经费">
      <t-alert style="margin-bottom: 14px" theme="info" title="填表说明：">
        <div slot="message">
          <p class="span-txt">
            1.项目申报时，只需填列项目经费来源和支出的预算数；在项目结题验收时，项目经费来源和支出的预算和决算数均需埴列。
          </p>
          <p>2.“其他”一栏是在与上几栏内容均不相同时具体填写。</p>
          <p>3.直接费用</p>
          <p>（1）设备费： 是指在项目研究开发过程中购置或试制专用仪器设备，对现有仪器设备 进行升级改造， 以及租赁外单位仪器设备而发生的费用。厅拨经费要严格控制设备购置费支出。</p>
          <p>
            （2）业务费：是指在项目实施过程中消耗的各种材料、辅助材料等低值易耗品的采购、运输、装卸、整理等费用，发生的测试化验加工、燃料动力、出版/文献/信息传播/知识产权事务、会议/差旅/国际合作交流等费用，以及其他相关支出。
          </p>
          <p>（3）劳务费： 是指在项目实施过程中支付给参与项目的研究生、博士后、访问学者和项目聘用的研究人员、科研辅助人员等的劳务性费用，以及支付给临时聘请的咨询专家的费用等。</p>
          <p>4.间接费用</p>
          <p>间接费用总额使用分段超额累退比例法计算和控制，按照不超过直接费用扣除设备购置费后的一定比例核定，具体比例如下：500万元及以下部分不超过30％；超过500万元至1000 万元的部分不超过25％；
            超过1000万元的部分不超过20％。</p>
          <p>（1）管理费：是指在项目研究开发过程中对使用本单位现有仪器设备及房屋，日常水、电、气、暖消耗，以及其他有关管理费用的补助支出。</p>
          <p>（2）绩效支出：是指承担项目研究任务的单位为提高科研工作绩效安排的相关支出。有财政拨款补助的单位安排的绩效支出不得超过直接费用扣除设备购置费后的5％。</p>
        </div>
      </t-alert>
      <project-budget v-model="data.projectBudget" :projectId="objId" phaseType="1"></project-budget>
    </t-tab-panel>
    <t-tab-panel :class="[reviewOpen ? 'tab-full-panel' : 'tab-panel']" value="5" label="项目进度">
      <project-research-plan ref="project-research-plan" v-model="data.researchPlanList" :projectId="objId"
        phaseType="1"></project-research-plan>
    </t-tab-panel>
    <t-tab-panel :class="[reviewOpen ? 'tab-full-panel' : 'tab-panel']" value="6" label="项目绩效指标">
      <project-kpi phaseType="1" :projectId="objId" ref="project-kpi" v-model="data.expectResultsList"></project-kpi>
    </t-tab-panel>
    <t-tab-panel :class="[reviewOpen ? 'tab-full-panel' : 'tab-panel']" value="7" label="项目可行性研究报告">
      <t-form ref="form" :colon="true" labelAlign="top">
        <t-row>
          <t-col :span="12">
            <t-card class="step-card" size="small" title="项目可行性研究报告">
              <t-form-item name="reportContent">
                <inner-html :content="data.feasibilityReport.reportContent"></inner-html>
              </t-form-item>
            </t-card>
          </t-col>
        </t-row>
      </t-form>
    </t-tab-panel>
    <t-tab-panel :class="[reviewOpen ? 'tab-full-panel' : 'tab-panel']" value="8" label="个人代表性研究成果">
      <t-row>
        <t-col :span="12">
          <t-card class="step-card" size="small" title="个人代表性研究成果（应列举申报书明确的研究人员成果；论文、论著不超过5篇；代表性成果和奖励数不超过10项）">
            <project-person-kpi phaseType="1" :use-old-data="true" :projectId="objId" ref="project-person-kpi"
              v-model="data.personResultsList"></project-person-kpi>
          </t-card>
        </t-col>
      </t-row>
    </t-tab-panel>
    <t-tab-panel :class="[reviewOpen ? 'tab-full-panel' : 'tab-panel']" value="9" label="单位信息">
      <t-row>
        <t-col :span="12">
          <project-unit ref="project-unit" v-model="data.projectCompanyList" :projectId="objId" phaseType="1"
            :isShowTable="data.secondReviewType == '1'"></project-unit>
        </t-col>
      </t-row>
    </t-tab-panel>
    <t-tab-panel :class="[reviewOpen ? 'tab-full-panel' : 'tab-panel']" value="10" label="附件信息">
      <t-row>
        <t-col :span="12">
          <t-table v-if="isMyProject" row-key="id" :columns="projectFileColumns" :data="projectFileData">
            <template #id="{ row, rowIndex }">
              {{ rowIndex + 1 }}
            </template>
            <template #op="{ row }">
              <file-upload v-if="['projectSBS', 'projectSMSCYJ', 'projectLXPSZJF'].includes(row.moduleKey)"
                @success="uploadSuccess" tips="限制pdf、图片" accept="application/pdf,image/*" v-model="row.fileIds"
                :moduleKey="row.moduleKey" :fileList="row.fileLists" :multiple="true">
                <t-button variant="outline">
                  <t-icon name="cloud-upload" slot="icon" />
                  点击上传
                </t-button>
              </file-upload>
              <a v-else class="t-button-link" target="_blank" v-for="(item, index) in row.fileLists" :href="item.url"
                :key="index">
                {{ item.name }}
              </a>
            </template>
            <template #c1="{ row }">
              <a v-if="row.c3" class="t-button-link" :href="`${file_domain}/${row.c3}`" target="_blank">{{ row.c1 }}</a>
              <div v-else>{{ row.c1 }}</div>
            </template>
          </t-table>
          <t-table v-else row-key="id" :columns="projectFileColumns" :data="projectFileData">
            <template #id="{ row, rowIndex }">
              {{ rowIndex + 1 }}
            </template>
            <template #c1="{ row }">
              <a v-if="row.c3" class="t-button-link" :href="`${file_domain}/${row.c3}`" target="_blank">{{ row.c1 }}</a>
              <div v-else>{{ row.c1 }}</div>
            </template>
            <template #op="{ row }">
              <div v-for="(item, index) in row.fileLists" :key="index">
                <a class="t-button-link" target="_blank" :href="item.url">
                  {{ item.name }}
                </a>
              </div>
            </template>
          </t-table>
        </t-col>
      </t-row>
    </t-tab-panel>
  </t-tabs>
</template>

<script>
import { VITE_FILE_DOMAIN } from '@/api/upload'
import innerHtml from "../../../../components/InnerHtml/index.vue";
import projectMember from "../../apply/components/project-member.vue";
import projectBudget from "../../apply/components/project-budget.vue";
import projectResearchPlan from "../../apply/components/project-research-plan.vue";
import projectKpi from "../../apply/components/project-kpi.vue";
import projectPersonKpi from "../../apply/components/project-person-kpi.vue";
import projectUnit from "../../apply/components/project-unit.vue";
import projectDigestDialog from "../../apply/components/project-digest-dialog.vue";
import { getFiles } from "@/api/common";
import FileUpload from "@/components/FileUpload/index.vue"


export default {
  name: "item-detail",
  dicts: ["subject_classification", "kjxm_team", "platform_type", "sys_user_sex", "prof_tit", "degree", "education"],
  components: {
    innerHtml,
    projectMember,
    projectBudget,
    projectResearchPlan,
    projectKpi,
    projectPersonKpi,
    projectUnit,
    projectDigestDialog,
    FileUpload
  },
  props: {
    objId: [String, Number],
    approveType: String,
    reviewOpen: {
      type: Boolean,
      default: false
    },
    hideInfo: {
      type: Boolean,
      default: false
    },
    isReview: {
      type: Boolean,
      default: false
    },
  },
  data () {
    return {
      dialog: {
        objId: null,
        open_digest: false,
      },
      isMyProject: false,
      columns: [
        {
          colKey: "index",
          title: "序号",
          align: "center",
          width: 90
        },
        {
          colKey: "projectName",
          title: "项目名称",
          align: "center",
          width: 120,
        },
        {
          colKey: "keyWord",
          title: "关键词",
          align: "center",
        },
        {
          colKey: "op",
          title: "附件列表",
          align: "center",
        }
      ],
      file_domain: VITE_FILE_DOMAIN,
      projectFileData: [
        {
          id: 1,
          c1: "查新报告",
          c2: "是",
          moduleKey: "projectCXBG",
          fileIds: [],
          fileLists: [],
          require: true,
        },
        {
          id: 2,
          c1: "项目承担单位科研诚信承诺书(模版)",
          c2: "是",
          c3: 'view/模板/项目承担单位科研诚信承诺书.pdf',
          fileIds: [],
          fileLists: [],
          moduleKey: "projectCNS",
          require: true,
        },
        {
          id: 3,
          c1: "项目组科研诚信承诺书(模版)",
          c2: "是",
          c3: 'view/模板/新项目组科研诚信承诺书.pdf',
          fileIds: [],
          fileLists: [],
          moduleKey: "projectTeamCNS",
          require: true,
        },
        {
          id: 4,
          c1: "归口管理单位同意申报函",
          c2: "由归口管理单位审批时上传",
          c3: 'view/模板/归口管理单位同意申报函模板.pdf',
          fileIds: [],
          fileLists: [],
          moduleKey: "projectGKTYSBH",
          require: false,
        },
        {
          id: 5,
          c1: "已盖章申报书",
          c2: "所有申报流程审批通过后，从系统导出PDF线下盖章(申报用户上传)",
          fileIds: [],
          fileLists: [],
          moduleKey: "projectSBS"
        },
        // {
        //   id: 9,
        //   c1: "立项评审专家费用转账凭证",
        //   c2: "立项评审完成后上传",
        //   fileIds: [],
        //   fileLists: [],
        //   moduleKey: "projectLXPSZJF"
        // },
        {
          id: 8,
          c1: "其他",
          c2: "否",
          moduleKey: "projectQT",
          fileIds: [],
          fileLists: [],
          require: false,
        },
      ],
      projectFileData2: [
        {
          id: 1,
          c1: "查新报告",
          c2: "是",
          moduleKey: "projectCXBG",
          fileIds: [],
          fileLists: [],
          require: true,
        },
        {
          id: 2,
          c1: "项目承担单位科研诚信承诺书(模版)",
          c2: "是",
          c3: 'view/模板/项目承担单位科研诚信承诺书.pdf',
          fileIds: [],
          fileLists: [],
          moduleKey: "projectCNS",
          require: true,
        },
        {
          id: 3,
          c1: "项目组科研诚信承诺书(模版)",
          c2: "是",
          c3: 'view/模板/新项目组科研诚信承诺书.pdf',
          fileIds: [],
          fileLists: [],
          moduleKey: "projectTeamCNS",
          require: true,
        },
        {
          id: 4,
          c1: "归口管理单位同意申报函",
          c2: "由归口管理单位审批时上传",
          c3: 'view/模板/归口管理单位同意申报函模板.pdf',
          fileIds: [],
          fileLists: [],
          moduleKey: "projectGKTYSBH",
          require: false,
        },
        {
          id: 5,
          c1: "研究试验费的请示",
          c2: "是",
          // c3: 'view/模板/新项目组科研诚信承诺书.pdf',
          fileIds: [],
          fileLists: [],
          moduleKey: "projectYJSYFDQS",
          require: true,
        },
        {
          id: 6,
          c1: "研究试验费的批复",
          c2: "是",
          // c3: 'view/模板/新项目组科研诚信承诺书.pdf',
          fileIds: [],
          fileLists: [],
          moduleKey: "projectYJSYFDPF",
          require: true,
        },
        {
          id: 7,
          c1: "立项审查情况的说明",
          c2: "由归口管理单位审批时上传",
          // c3: 'view/模板/新项目组科研诚信承诺书.pdf',
          fileIds: [],
          fileLists: [],
          moduleKey: "projectLXSCQKDSM",
          require: false,
        },
        {
          id: 8,
          c1: "已盖章申报书",
          c2: "所有申报流程审批通过后，从系统导出PDF线下盖章(申报用户上传)",
          fileIds: [],
          fileLists: [],
          moduleKey: "projectSBS"
        },
        // {
        //   id: 10,
        //   c1: "立项评审专家费用转账凭证",
        //   c2: "立项评审完成后上传",
        //   fileIds: [],
        //   fileLists: [],
        //   moduleKey: "projectLXPSZJF"
        // },
        {
          id: 9,
          c1: "其他",
          c2: "否",
          moduleKey: "projectQT",
          fileIds: [],
          fileLists: [],
          require: false,
        },
      ],
      projectFileData3: [
        {
          id: 9,
          c1: "相关附件",
          c2: "否",
          moduleKey: "projectQT",
          fileIds: [],
          fileLists: [],
          require: false,
        },
      ],
      projectFileColumns: [
        {
          colKey: "id",
          title: "序号",
          align: "center",
          width: 64
        },
        {
          colKey: "c1",
          title: "附件名称",
          align: "center",
        },

        {
          colKey: "c2",
          title: "是否必需",
          align: "center",
        },
        {
          colKey: "op",
          title: "附件列表",
          align: "left",
        },
      ],
      value: "1",
      data: {
        projectLeader: {},
        projectLeaderResults: {},
        projectLinker: {},
        projectTeam: {},
        projectOverview: {},
        expectResultsList: [],
        projectMemberList: [],
        researchPlanList: [],
        feasibilityReport: {},
        personResultsList: [],
        projectCompanyList: [],
        projectEsModelList: [],
      },
      site_tag: import.meta.env.VITE_SITE_TAG,
      profTitOptions: [],
      deptMenuOptions: [],
      categoryOptions: [],
    }
  },
  watch: {
    objId: {
      immediate: true,
      handler (val) {
        if (val) {
          this.getObj(val);
        }
      }
    },
  },
  created () {
    this.getPlanCategoryList();
    this.getDeptTreeSelect();
    this.getProfTitTreeSelect();
  },
  methods: {
    getObj () {
      // if(this.hideInfo){
      //   this.$api.kjxm.project.getAllHide(this.objId).then(response => {
      //     console.log(response)
      //     if (response.data.createUserId === Number(this.$store.state.user.userId)) {
      //       this.isMyProject = true;
      //     }
      //     Object.assign(this.data, response.data);
      //   }).catch((e) => {
      //     this.$message.error(e.toString());
      //   });
      // }else {
      //   this.$api.kjxm.project.getNewAll(this.objId).then(response => {
      //     if (response.data.createUserId === Number(this.$store.state.user.userId)) {
      //       this.isMyProject = true;
      //     }
      //     if ([1660720633654].includes(response.data.projectCategory)){
      //       this.projectFileData = this.projectFileData2;
      //     } else if ([1662099020236].includes(response.data.projectCategory)) {
      //       this.projectFileData = this.projectFileData3;
      //     } else {
      //       this.projectFileData = this.$options.data.call(this).projectFileData;
      //     }
      //     Object.assign(this.data, response.data);

      //     getFiles(this.objId).then((res) => {
      //       const files = {}
      //       res.data.forEach((project) => {
      //         if (!files[project.moduleKey]) {
      //           files[project.moduleKey] = []
      //         }
      //         files[project.moduleKey].push({
      //           name: project.fileName,
      //           url: project.fullFilePath,
      //           id: project.id,
      //           filePath: project.filePath
      //         })
      //       })
      //       this.projectFileData.forEach((val,index)=>{
      //         this.projectFileData[index].fileLists = files[val.moduleKey] || [];
      //         this.projectFileData[index].fileIds = files[val.moduleKey]?.map(val => val.id) || [];
      //       })
      //     }).catch((e) => {
      //       this.$message.error(e.toString());
      //     });
      //   }).catch((e) => {
      //     this.$message.error(e.toString());
      //   });
      // }
      this.$api.kjxm.project.getNewAll(this.objId).then(response => {
        if (response.data.createUserId === Number(this.$store.state.user.userId)) {
          this.isMyProject = true;
        }
        if ([1660720633654].includes(response.data.projectCategory)) {
          this.projectFileData = this.projectFileData2;
        } else if ([1662099020236].includes(response.data.projectCategory)) {
          this.projectFileData = this.projectFileData3;
        } else {
          this.projectFileData = this.$options.data.call(this).projectFileData;
        }
        Object.assign(this.data, response.data);

        getFiles(this.objId).then((res) => {
          const files = {}
          res.data.forEach((project) => {
            if (!files[project.moduleKey]) {
              files[project.moduleKey] = []
            }
            files[project.moduleKey].push({
              name: project.fileName,
              url: project.fullFilePath,
              id: project.id,
              filePath: project.filePath
            })
          })
          this.projectFileData.forEach((val, index) => {
            this.projectFileData[index].fileLists = files[val.moduleKey] || [];
            this.projectFileData[index].fileIds = files[val.moduleKey]?.map(val => val.id) || [];
          })
        }).catch((e) => {
          this.$message.error(e.toString());
        });
      }).catch((e) => {
        this.$message.error(e.toString());
      });

    },
    getProfTitTreeSelect () {
      return this.$api.system.profTit.list().then(response => {
        this.profTitOptions = this.handleTree(response.data, "id");
      }).catch((e) => {
        this.$message.error(e.toString());
      });
    },
    getDeptTreeSelect () {
      return this.$api.system.dept.treeSelectAllIn().then(response => {
        this.deptMenuOptions = response.data;
      }).catch((e) => {
        this.$message.error(e.toString());
      });
    },
    getPlanCategoryList () {
      this.$api.kjxm.project.planCategoryList(this.queryParams).then(
        (res) => {
          const projectCategoryData = res.data.filter((val) => {
            if (!val.parentId) { return true }
          })
          this.projectCategoryData = projectCategoryData;
          this.categoryOptions = projectCategoryData.map((val) => ({ label: val.name, value: val.id }))
        }).catch((e) => {
          this.dataLoading = false;
          this.$message.error(e.toString());
        });
    },
    uploadSuccess (ids) {
      this.$api.kjxm.project.edit({
        id: this.objId,
        sysAttMainVo: {
          sysAttMainIds: ids,
        }
      }).then(val => {
        this.$message.success("上传成功");
      }).catch((e) => {
        this.$message.error(e.toString());
      });
    },
  }
}
</script>

<style lang="less" scoped>
.t-tab-panel {
  padding: 10px;
}

.tab-panel {
  height: calc(65vh - 64px);
  overflow: scroll;
}

.tab-full-panel {
  height: calc(80vh - 64px);
  overflow: scroll;
}

.t-form__project {
  margin-bottom: 6px
}

.t-row {
  margin-bottom: 14px;
}

.step-card {
  margin-bottom: 14px;
}
</style>
